/*
 * Component.h
 */
#ifndef _COMPONENT_H_
#define _COMPONENT_H_

#include <allegro.h>
#include "defs.h"

namespace gui
  {
    class ComponentManager;
    class GraphicContext;

    class Component
      {
        static int _lastId;
        static GraphicContext _maskGc;

        int _id;
        Component* _parent;

      protected:
        Point _position;
        Size _size;

      public:
        Component();

        Component* parent(Component* parent);

        virtual void init();
        virtual void process();
        
        virtual void paint(BITMAP* buffer, int x_offset, int y_offset) = 0;
        virtual void mask(BITMAP* buffer, int x_offset, int y_offset);

        int const& id() const;

        Component* parent();

        virtual GraphicContext const& maskGc() const;

        int const& x() const;
        int const& y() const;
        int const& width() const;
        int const& height() const;

        Point const& position() const;
        Point const& move(Point& point);
        Point const& move(int x, int y);

        Size const& size() const;
        Size const& size(Size& size);
        Size const& size(int width, int height);

        bool const hasFocus() const;
        //bool const requestFocus() const;
      };

  }

#endif
